import { createStore, combineReducers } from 'redux'
import { count } from './reducer/count'
import { num } from './reducer/num'

let reducer = (state, action) => {
    let NewState = JSON.parse(JSON.stringify(state))
    switch(action.type) {
        case "ADD":
            NewState.count += 1
            return NewState
        case "NUM_ADD":
            NewState.num += 1
            return NewState
        default:
            return state
    }
}

let reducer = (state, action) => {
    return {
        count: count(state.count, action),
        num: num(state.num, action)
    }
}

let initState = {
    count: 8888,
    num: 999
}

let store = createStore(reducer, initState)


export default store